import requests from "./requests";
import utils from "@/utils";
const baseURL = "http://192.168.31.63:3066";
//通过isbn搜索书籍
export const searchBookByISBN = (ISBN) =>
  requests({
    method: "GET",
    url: "/api/searchBookByISBN",
    data: {
      ISBN,
    },
  });
//   上传图片
export const uploadBookCover = (file) => {
  return new Promise((resolve, reject) => {
    uni.uploadFile({
      url: baseURL + "/api/uploadImage",
      filePath: file,
      name: "file",
      header: {
        Authorization: "Bearer " + utils.getToken() || "", //携带token
      },
      success: (res) => {
        resolve(res);
      },
      fail: (error) => {
        reject(error);
      },
    });
  });
};
